import { ref } from 'vue'
import { defineStore } from 'pinia'
import { loginApi } from '@/apis/user'
export const userStore = defineStore('user', () => {
  const userinfo = ref([])
  const getLoginApi = async ({ account, password }) => {
    const res = await loginApi({ account, password })
    userinfo.value = res.result
    console.log(res)
  }
  const clearlogin = () => {
    userinfo.value = []
  }

  return { userinfo, getLoginApi, clearlogin }
}, {
  persist: true
})
